package com.cskaoyan.exception;

import com.cskaoyan.bean.common.BaseRespVo;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

/**
 * @author stone
 * @date 2022/07/18 10:20
 */
@RestControllerAdvice
public class ValidationExceptionControllerAdvice {

    @ExceptionHandler(ValidationException.class)
    public BaseRespVo validationException(ValidationException exception) {
        String message = exception.getMessage();
        return BaseRespVo.invalidParameter(message);
    }
}
